﻿<%@ Page Language="C#" MasterPageFile="~/Themes/MasterPage.master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="mainContent" runat="Server">
    <div class="member">
        <lswweb:SkinControl ID="menum" SkinFileName="Globals_UserMenum.ascx" runat="server" />
        <div class="rightBox">
            <div class="welcome">
                <h3>
                    Hello,<%= (SiteContext.Current.User.Profile!=null && !string.IsNullOrEmpty(SiteContext.Current.User.Profile.Name))?SiteContext.Current.User.Profile.Name: SiteContext.Current.UserName %> Welcome back!
                    <span id="vip" style="display:none;">Your is Vip.</span></h3>
                <p>
                    Current time:<span id="dateTime"></span>
                    <script language="JavaScript" type="text/javascript">
                        function SetTime() {
                            var Timer = new Date();
                            var minutes = Timer.getMinutes();
                            var seconds = Timer.getSeconds();

                            if(minutes<10)
                                minutes="0{0}".format(minutes);

                            if(seconds<10)
                                seconds="0{0}".format(seconds);
                             
                            var text = "{0}-{1}-{2} {3}:{4}:{5}".format(Timer.getYear(), Timer.getMonth() + 1, Timer.getDate(), Timer.getHours(), minutes, seconds);

                            $("#dateTime").text(text);

                            setTimeout("SetTime()", 1000)
                        }

                        $(function () {
                            SetTime();

                            if ("<%= Users.UserIsVip(SiteContext.Current.User.Id) %>" == "True") {
                                $("#vip").show();
                            }
                        }) 
                    </script>
                </p>
            </div>
            <div class="User_Info">
                <table width="100%">
                    <tbody>
                        <tr>
                            <td width="33%">
                                Completed orders:<%= Orders.GetEndOrderNumber(SiteContext.Current.User.Id) %>
                            </td>
                            <td colspan="2">
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td width="33%">
                                Spending six months:
                                <font color="#dc036b">
                                    <b><%= CurrencyServices.ForamtPrice(Orders.GetBuyTotalMoney(SiteContext.Current.User.Id, new Pair<DateTime?>(DateTime.Now.AddMonths(-6), DateTime.Now)))%> </b></font>
                            </td>
                            <td width="34%">
                                Total consumption:
                                <font color="#dc036b">
                                    <b><%= CurrencyServices.ForamtPrice(Orders.GetBuyTotalMoney(SiteContext.Current.User.Id,new Pair<DateTime?>(null,null)))%></b></font>
                            </td>
                            <td>
                                &nbsp;&nbsp;
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div class="User_Tip">
                Tips: <a href="<%= this.Urls.MyOrder(0) %>"><font color="#dc036b"><b><%= Orders.GetNotEndOrderNumber(SiteContext.Current.User.Id) %></b></font> pending orders</a>
            </div>
        </div>
        <div class="clear"></div>
    </div>
</asp:Content>
